<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">
	<title>Sistema de Contabilidad</title>	
	<link rel="stylesheet" href="/media/css/style.css" type="text/css" media="screen" />
    <link href="/media/css/dropdown.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/media/css/default.css" media="screen" rel="stylesheet" type="text/css" />
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta http-equiv="content-language" content="en-gb" />
	<meta http-equiv="imagetoolbar" content="false" />
</head>
<TITLE>Agregar Asiento</TITLE>

<script type="text/javascript" src="/media/js/CalendarPopup.js"></script>
<script type="text/javascript">
var cal1xx = new CalendarPopup("testdiv1");
        cal1xx.showNavigationDropdowns();
        document.write(getCalendarStyles());
        writeSource("jscal1xx");
        
        function validar(e) { // 1
            tecla = (document.all) ? e.keyCode : e.which;
            if (tecla==8) return true; //Tecla de retroceso (para poder borrar)
            if (tecla==0) return true;
            patron = /[1234567890.-]/;// Solo acepta numeros y el punto y el guion

            te = String.fromCharCode(tecla);
            return patron.test(te); 
        } 
        
        function verificarsuma(frm){
            var sumadebe=0, sumahaber=0;

            for(i=1;i<=12;i++){
                if(frm['d'+i].value == ''){
                    frm['d'+i].value = 0;
                }
                if(frm['h'+i].value == ''){
                    frm['h'+i].value = 0;
                }
            }
            for(i=1;i<=12;i++){
                sumadebe = sumadebe + parseFloat(frm['d'+i].value);
                sumahaber = sumahaber + parseFloat(frm['h'+i].value);
            }
            if (sumadebe != sumahaber){
                alert('Las sumas no coinciden');
				frm.boton.disabled = true;
            }else{
                frm['totald'].value = sumadebe;
                frm['totalh'].value = sumadebe;
                frm.boton.disabled = false;
                //document.formu.submit();
            }
        }
        
        function verificarcampos(frm){
             if(frm['date1xx'].value == ""){
                alert("Ingrese fecha del documento");
                return 0;
            }
            
            for(i=1;i<=12;i++){
                if(frm['d'+i].value != 0){
                    if(frm['cd'+i].value == ''){
                        alert("Complete el tipo de cuenta")
                        return 0;
                    }
                }
                if(frm['h'+i].value != 0){
                    if(frm['ch'+i].value == ''){
                        alert("Complete el tipo de cuenta")
                        return 0;
                    }
                }
                
            }
            if(frm['comentarios'].value.length >= 101 ) {
                alert("Se permiten hasta 100 caracteres para comentarios")
                return 0;
            }
            document.formu.submit();
        }
</script>


<BODY onload="inicializar();">
    <div>
    <table align="center" border="0">
    <td align="left" width=11%><h3>Bienvenido<font color="#888"> {{nombreuser}}</font> </h3></td>
    </div>
    <td align="right" width=82%>
	<div id="header">
		<h1>Contabilidad</h1>
		<h2>Sistema Contable - Obispado</h2>
	</div></td>
    <tr>
    </TABLE>
	<ul id="nav" class="dropdown dropdown-horizontal">
        <li><a href="/obispado/logout/">Desconectarse</a></li>
        <li class="dir">Ingresos ▼
            <ul>
                <li><a href="/obispado/carga_ingresos/">Cargar Ingresos</a></li>
                <li><a href="/obispado/ingresos_list/">Ver Ingresos</a></li>
                <li><a href="/obispado/solicitar_planilla_ingresos/">Planilla Ingresos</a></li>
            </ul>
        </li>
        <li class="dir">Egresos ▼
            <ul>
                <li><a href="/obispado/carga_egresos/">Cargar Egresos</a></li>
                <li><a href="/obispado/egresos_list/">Ver Egresos</a></li>
                <li><a href="/obispado/solicitar_planilla_egresos/">Planilla Egresos</a></li>
            </ul>
        </li>
        <li class="dir">Asientos ▼
            <ul>
                <li><a href="/obispado/cargar_asiento/">Cargar Asientos</a></li>
                <li><a href="/obispado/asientos_list/">Ver Asientos</a></li>
            </ul>
        </li>

        <li><a href="/obispado/admin/aportantes/aportante/">Aportantes</a></li>
        <li><a href="/obispado/admin/proveedores/proveedor/">Proveedores</a></li>
        <li><a href="/obispado/balances/csv/">Generar Balance</a></li>
        <li class="dir">Administrar Sistema ▼
            <ul>
                <li><a href="/obispado/admin/">Administracion General</a></li>
                <li><a href="/obispado/registro/">Crear un nuevo usuario</a></li>
                <li><a href="/obispado/admin/password_change/">Cambiar Contrase&ntilde;a del usuario actual</a></li>
                <li><a href="/obispado/ver_logs">Ver logs</a></li>
            </ul>
        </li>
    </ul>
    <br></br>
	<div id="content" align="center">
    
<H1 align="center">Cargar Nuevo Asiento</H1> 
{% if msj %}
			<table align="center" style="float:center;border:3px solid red;">
			<td align="center" width="500">{{msj}}</td>
            <tr>
            </TABLE>
            <br>
{% endif %}
<FORM action="/obispado/cargar_asiento/" METHOD="GET" name="formu">
<table align="center" border="0">
<td align="right" width="200">Fecha:
</td>

<td align="left" width="200"><input name="date1xx" value="" type="text"><a href="#" onclick="cal1xx.select(document.forms[0].date1xx,'anchor1xx','dd/MM/yyyy'); return false;" title="cal1xx.select(document.forms[0].date1xx,'anchor1xx','dd/MM/yyyy'); return false;" name="anchor1xx" id="anchor1xx">Elegir</a>
</td>

<tr>
<br>
</table>
<table align="center" border="0">
<tr>
<td align='left' width='20'><b>Debe</b></td><td align='left' width='20'>Monto</td><td align='left' width='20'><b>Haber</b></td><td align='left' width='20'>Monto</td><tr>
<td align='left' width='150'><select name="cd1" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d1" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch1" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h1" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd2" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d2" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch2" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h2" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd3" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d3" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch3" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h3" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd4" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d4" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch4" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h4" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd5" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d5" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch5" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h5" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd6" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d6" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch6" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h6" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd7" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d7" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch7" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h7" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd8" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d8" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch8" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h8" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd9" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d9" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch9" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h9" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd10" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d10" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch10" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h10" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd11" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d11" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch11" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h11" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>
<tr>
<td align='left' width='150'><select name="cd12" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentasd %}
                                {% for i in listcuentasd %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="d12" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td><td align='left' width='150'><select name="ch12" id="id_pro" onchange="poner_ruc(this.value);">

                            <option value="" selected="selected">---------</option>
                            {% if listcuentash %}
                                {% for i in listcuentash %}
                                    <option value="{{ i.id }}">{{ i.nombre }}</option>
                                {% endfor %}
                            {% endif %}
                            <!--option value="d">Debe</option>
                            <option value="h">Haber</option>
                            <option value="h4">Fer</option-->
</select></td>
<td align="center" width="150"><INPUT NAME="h12" TYPE="TEXT" VALUE="" onkeypress="return validar(event);">
</td>

</table>
<table align="center" border="0">

<td align='left' width='150'>Total</td>
<td align="center" width="150"><INPUT NAME="totald" TYPE="TEXT" VALUE="">
</td><td align="center" width="150"></td>
<td align="center" width="150"><INPUT NAME="totalh" TYPE="TEXT" VALUE="">
</td>
<tr>
<tr>
<br>
<td align="center" width="150"></td>
<TD align="left" width="150">Comentarios</TD>
	<TD>
	<TEXTAREA rows="3" name="comentarios" value="">
	</TEXTAREA>
<tr>
<td align="center" width="150"></td><td align="center" width="150"><INPUT NAME="botons" type="button" id="butsum" VALUE="Sumar" onclick="verificarsuma(this.form);"></td>
<td align="center" width="150"><INPUT NAME="boton" type="button" id="butenv" VALUE="Enviar" disabled="disabled" onclick="verificarcampos(this.form);">
</td>
</table>



</FORM>
<DIV ID="testdiv1" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"></DIV>
<tr>

</BODY>
</HTML>

